<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
	<xsl:attribute-set name="textblock">
		<xsl:attribute name="font-family">Arial</xsl:attribute>
		<xsl:attribute name="font-size">9pt</xsl:attribute>
	</xsl:attribute-set>
	<xsl:attribute-set name="title">
		<xsl:attribute name="font-family">Arial</xsl:attribute>
		<xsl:attribute name="font-size">18pt</xsl:attribute>
		<xsl:attribute name="font-weight">bold</xsl:attribute>
		<xsl:attribute name="text-align">center</xsl:attribute>	
		<xsl:attribute name="margin-bottom">10px</xsl:attribute>	
	</xsl:attribute-set>
	<xsl:attribute-set name="headerText">
		<xsl:attribute name="font-family">Arial</xsl:attribute>
		<xsl:attribute name="font-size">9pt</xsl:attribute>
		<xsl:attribute name="font-weight">bold</xsl:attribute>
	</xsl:attribute-set>
	<xsl:attribute-set name="headerCell">
		<xsl:attribute name="font-family">Arial</xsl:attribute>
		<xsl:attribute name="font-size">9pt</xsl:attribute>
		<xsl:attribute name="font-weight">bold</xsl:attribute>
		<xsl:attribute name="padding">2pt</xsl:attribute>
		<xsl:attribute name="border">0.5pt solid black</xsl:attribute>
		<xsl:attribute name="background-color">gray</xsl:attribute>		
		<xsl:attribute name="text-align">center</xsl:attribute>		
	</xsl:attribute-set>
	<xsl:attribute-set name="headerCell1">
		<xsl:attribute name="font-family">Arial</xsl:attribute>
		<xsl:attribute name="font-size">9pt</xsl:attribute>
		<xsl:attribute name="font-weight">bold</xsl:attribute>
		<xsl:attribute name="padding">2pt</xsl:attribute>
		<xsl:attribute name="border">0.5pt solid black</xsl:attribute>
		<xsl:attribute name="background-color">gray</xsl:attribute>		
		<xsl:attribute name="text-align">left</xsl:attribute>	
	</xsl:attribute-set>
	<xsl:attribute-set name="pageNumber">
		<xsl:attribute name="font-family">Arial</xsl:attribute>
		<xsl:attribute name="font-size">10pt</xsl:attribute>
	</xsl:attribute-set>
	<xsl:template match="/">
		<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
			<!-- defines the layout master -->
			<fo:layout-master-set>
				<fo:simple-page-master master-name="first" page-height="21cm" page-width="29.7cm" margin-top="1cm" margin-bottom="5mm"
					margin-left="1cm" margin-right="1cm">
					<fo:region-body  margin-top="0cm" margin-bottom="1cm" />
					<fo:region-before extent="0cm" />
					<fo:region-after extent="5mm" />
				</fo:simple-page-master>
			</fo:layout-master-set>
			<!-- starts actual layout -->
			<fo:page-sequence master-reference="first">
				<fo:static-content flow-name="xsl-region-after">
					<fo:block xsl:use-attribute-sets="pageNumber">Page <fo:page-number /></fo:block>
				</fo:static-content>							
				<fo:flow flow-name="xsl-region-body">
					<fo:block xsl:use-attribute-sets="title">Customer Order Report</fo:block>
					<!-- table start -->
					<fo:table table-layout="fixed" border="0.5pt solid black">
						<fo:table-column column-width="8mm"/>
						<fo:table-column column-width="20mm"/>
						<fo:table-column column-width="250mm"/>
						<fo:table-body>
							<fo:table-row>
									<fo:table-cell xsl:use-attribute-sets="headerCell"><fo:block xsl:use-attribute-sets="headerText">No</fo:block></fo:table-cell>
									<fo:table-cell xsl:use-attribute-sets="headerCell"><fo:block xsl:use-attribute-sets="headerText">Date</fo:block></fo:table-cell>
									<fo:table-cell xsl:use-attribute-sets="headerCell1"><fo:block xsl:use-attribute-sets="headerText">Customer Information</fo:block></fo:table-cell>
							</fo:table-row>
							<xsl:for-each select="bulkorders/bulkorder">
								<fo:table-row>
									<!-- First row  customer information -->
									<fo:table-cell padding="2pt" border="0.5pt solid black"><fo:block xsl:use-attribute-sets="textblock"><xsl:value-of select="./No" /></fo:block></fo:table-cell>
									<fo:table-cell padding="2pt" border="0.5pt solid black"><fo:block xsl:use-attribute-sets="textblock"><xsl:value-of select="./OrderDate" /></fo:block></fo:table-cell>
									<fo:table-cell padding="2pt" border="0.5pt solid black">
										<fo:table table-layout="fixed" >
										<fo:table-column />
										<fo:table-body>
										 <fo:table-row>
											<fo:table-cell><fo:block xsl:use-attribute-sets="textblock"><xsl:value-of select="./CompanyName" /></fo:block></fo:table-cell>
										 </fo:table-row>
										 <fo:table-row>
											<fo:table-cell><fo:block xsl:use-attribute-sets="textblock"><xsl:value-of select="./CustomerName" /></fo:block></fo:table-cell>
										 </fo:table-row>
										 <fo:table-row>
											<fo:table-cell><fo:block xsl:use-attribute-sets="textblock"><xsl:value-of select="./StreetAddress" /></fo:block></fo:table-cell>
										 </fo:table-row>
										 <fo:table-row>
											<fo:table-cell><fo:block xsl:use-attribute-sets="textblock"><xsl:value-of select="./AddressInfo" /></fo:block></fo:table-cell>
										 </fo:table-row>
										 <fo:table-row>
											<fo:table-cell><fo:block xsl:use-attribute-sets="textblock"><xsl:value-of select="./EmailAddress" /></fo:block></fo:table-cell>
										 </fo:table-row>
										 </fo:table-body>
										</fo:table>
									</fo:table-cell>
								</fo:table-row>
								<!-- Second row  order information -->
								<fo:table-row>
									<fo:table-cell padding="2pt" >
									<fo:table table-layout="fixed" >
										<fo:table-column column-width="28mm"/>
										<fo:table-column column-width="250mm"/>
										<fo:table-body>
										<fo:table-row>
											<fo:table-cell column-width="28mm" ><fo:block xsl:use-attribute-sets="headerText">Order Information: </fo:block></fo:table-cell>
											<fo:table-cell column-width="250mm">
												<xsl:if test="./OrderType = 'True'">
													<fo:table table-layout="fixed" >
														<fo:table-column column-width="35mm"/>
														<fo:table-column column-width="35mm"/>
														<fo:table-column column-width="35mm"/>
														<fo:table-column column-width="67mm"/>
														<fo:table-column column-width="68mm"/>
													<fo:table-body>
														<fo:table-row>
															<fo:table-cell><fo:block xsl:use-attribute-sets="textblock"><xsl:value-of select="./Qty20" /></fo:block></fo:table-cell>
															<fo:table-cell><fo:block xsl:use-attribute-sets="textblock"><xsl:value-of select="./Qty40" /></fo:block></fo:table-cell>
															<fo:table-cell><fo:block xsl:use-attribute-sets="textblock"><xsl:value-of select="./Qty40HC" /></fo:block></fo:table-cell>
															<fo:table-cell><fo:block xsl:use-attribute-sets="textblock">Total Volume: <xsl:value-of select="./TotalVolume" /></fo:block></fo:table-cell>
															<fo:table-cell><fo:block xsl:use-attribute-sets="textblock">Total Weight: <xsl:value-of select="./TotalWeight" /></fo:block></fo:table-cell>
														</fo:table-row>
													</fo:table-body>
													</fo:table>
												</xsl:if>
												<xsl:if test="./OrderType = 'False'">
													<fo:table>
													<fo:table-column column-width="80mm"/>
													<fo:table-column column-width="80mm"/>
													<fo:table-column column-width="80mm"/>
													<fo:table-body>
														<fo:table-row>
															<fo:table-cell><fo:block xsl:use-attribute-sets="textblock">Existing production Order No:<xsl:value-of select="./OrderNo" /></fo:block></fo:table-cell>
															<fo:table-cell><fo:block xsl:use-attribute-sets="textblock">Half Pallet spaces:  <xsl:value-of select="./HalfPalletSpaces" /></fo:block></fo:table-cell>
															<fo:table-cell><fo:block xsl:use-attribute-sets="textblock">Filled volume:<xsl:value-of select="./FilledVolume" /></fo:block></fo:table-cell>
														</fo:table-row>
													</fo:table-body>
													</fo:table>
												</xsl:if>
											</fo:table-cell>
										</fo:table-row>
									</fo:table-body>
									</fo:table>
									</fo:table-cell>
								</fo:table-row>
								<!-- end second row  order information -->
							</xsl:for-each>
						</fo:table-body>
					</fo:table>
					<!-- table end -->
				</fo:flow>
			</fo:page-sequence>
		</fo:root>
	</xsl:template>
</xsl:stylesheet>
